package hanqi.mangement.Controller;

import hanqi.mangement.Service.courseservice;
import hanqi.mangement.entity.course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("course")
public class courseController {
    @Autowired
    private courseservice courseservice;
    @GetMapping("/listAll")
    public List<course> listAll() {
        return courseservice.listAll();
    }

    @GetMapping("/getById/{courseId}")
    public course getById(@PathVariable int courseId) {
        return courseservice.getById(courseId);
    }

    @PostMapping("/add")
    public String add(@RequestBody course course) {
        courseservice.addCourse(course);
        return "数据插进来了喵(=^・ω・^=)ノ☆";
    }
}
